package ee.homework.first;

public class BinarySearch {

	public int binarySearch(int[] array, int value, int low, int high) {
		if (high < low) {
			return -1;
		}
		int mid = low + ((high - low) / 2);
		if (array[mid] > value) {
			return binarySearch(array, value, low, mid - 1);
		} else if (array[mid] < value) {
			return binarySearch(array, value, mid + 1, high);
		} else {
			return mid;
		}
	}
}
